﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Input;
using CoiffeurProject.Screens;
using System.Windows.Shapes;
using CoiffeurProject.DBMS;
using CoiffeurProject.DBMS.Entities;
using CoiffeurProject.UserControls;

namespace CoiffeurProject.Utils
{
    #region Images Path

    internal static class ImagesPath
    { 
        internal static string SearchBackground = @"pack://application:,,,/CoiffeurProject;component/Images/UserControls/filter_text_box.PNG";
        internal static string AgendaPage = @"pack://application:,,,/CoiffeurProject;component/Images/Main/agenda_page.png";
        internal static string PressedTicket = @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/bigliettopressed.png";
        internal static string PressedIcon = @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/iconpressed.png";
        internal static string Blank = @"pack://application:,,,/CoiffeurProject;component/Images/Main/transparent_texture.png";
        internal static string Lens = @"pack://application:,,,/CoiffeurProject;component/Images/UserControls/lens.PNG";
        internal static string XIcon = @"pack://application:,,,/CoiffeurProject;component/Images/UserControls/exit_button_icon.PNG";
        internal static string SelectedCustomer = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/customer_selected.png";
        internal static string CusDashArrowLeft = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/dash_sx.png";
        internal static string CusDashArrowRight = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/dash_dx.png";
        internal static string CusDashArrowLeftPress = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/dash_sx_pressed.png";
        internal static string CusDashArrowRightPress = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/dash_dx_pressed.png";
        internal static string MaleIcon = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/male_icon.PNG";
        internal static string FemaleIcon = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/female_icon.PNG";
        internal static string NotificationIcon = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/Icons/notification_circle.PNG";
        internal static string DashThumb = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/dash_thumb.PNG";
        internal static string ActiveTB = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/Form/active_text_box.PNG";
        internal static string UnactiveTB = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/Form/text_box.PNG";
        internal static string ActiveMLTB = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/Form/multiline_active_text_box.PNG";
        internal static string UnactiveMLTB = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/Form/multiline_text_box.PNG";
        internal static string CheckBox = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/Form/check_box.PNG";
        internal static string EmptyCheckBox = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/Form/empty_check_box.PNG";
        internal static string ActiveBTN = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/Form/active_save_btn.PNG";
        internal static string UnactiveBTN = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/Form/save_btn.PNG";
        internal static string Active2DigitTB = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/Form/active_day_mon_tb.PNG";
        internal static string Unactive2DigitTB = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/Form/day_mon_tb.PNG";
        internal static string Active4DigitTB = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/Form/active_year_tb.PNG";
        internal static string Unactive4DigitTB = @"pack://application:,,,/CoiffeurProject;component/Images/Customer/Form/year_tb.PNG";
    }

    #endregion

    #region MainWindow Ticket Button

    internal static class MainTicketButtonFactory
    {

        #region Main Window Click Event Handlers

        internal static Action<object, RoutedEventArgs>[] GetCalendarPanelClickEventHandlers()
        {
            Action<object, RoutedEventArgs>[] actions = new Action<object, RoutedEventArgs>[] { 
                delegate(object sender, RoutedEventArgs e) { CalendarScreen form = new CalendarScreen(); form.Show(); },
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
            };

            return actions;
        }

        internal static Action<object, RoutedEventArgs>[] GetCustomersPanelClickEventHandlers(Database db, Window owner)
        {
            Action<object, RoutedEventArgs>[] actions = new Action<object, RoutedEventArgs>[] { 
                delegate(object sender, RoutedEventArgs e) { CustomerScreen form = new CustomerScreen(db); owner.DisableForegroundWindow(form); },
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {
                    CustomerForm form = new CustomerForm(db);
                    owner.DisableForegroundWindow(form);
                }
            };

            return actions;
        }

        internal static Action<object, RoutedEventArgs>[] GetServicesPanelClickEventHandlers()
        {
            Action<object, RoutedEventArgs>[] actions = new Action<object, RoutedEventArgs>[] { 
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
            };

            return actions;
        }

        internal static Action<object, RoutedEventArgs>[] GetWarehousePanelClickEventHandlers()
        {
            Action<object, RoutedEventArgs>[] actions = new Action<object, RoutedEventArgs>[] { 
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
            };

            return actions;
        }

        internal static Action<object, RoutedEventArgs>[] GetEmployeesPanelClickEventHandlers(Database db, Window owner)
        {
            Action<object, RoutedEventArgs>[] actions = new Action<object, RoutedEventArgs>[] { 
                delegate(object sender, RoutedEventArgs e) { EmployeeScreen form = new EmployeeScreen(db); owner.DisableForegroundWindow(form); },
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
            };

            return actions;
        }

        internal static Action<object, RoutedEventArgs>[] GetAccountingPanelClickEventHandlers()
        {
            Action<object, RoutedEventArgs>[] actions = new Action<object, RoutedEventArgs>[] { 
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
                delegate(object sender, RoutedEventArgs e) {  },
            };

            return actions;
        }

        #endregion

        #region Main Window Button Panels

        internal static Grid GetCalendarPanel(int row, int column)
        {
            Grid main_container = new Grid()
            {
                Margin = new Thickness(58, 85, 0,0)
            };

            CreateButtons(main_container, CalendarStrings, GetCalendarPanelClickEventHandlers());

            Grid.SetColumn(main_container, column);
            Grid.SetRow(main_container, row);

            return main_container;
        }

        internal static Grid GetCustomersPanel(Window owner, int row, int column, Database db)
        {
            Grid main_container = new Grid()
            {
                Margin = new Thickness(58 + 311, 85, 0, 0)
            };

            CreateButtons(main_container, CustomersStrings, GetCustomersPanelClickEventHandlers(db, owner));

            Grid.SetColumn(main_container, column);
            Grid.SetRow(main_container, row);

            return main_container;
        }

        internal static Grid GetServicesPanel(int row, int column)
        {
            Grid main_container = new Grid()
            {
                Margin = new Thickness(58 + 311 * 2, 85, 0, 0)
            };

            CreateButtons(main_container, ServicesStrings, GetServicesPanelClickEventHandlers());

            Grid.SetColumn(main_container, column);
            Grid.SetRow(main_container, row);

            return main_container;
        }

        internal static Grid GetWarehousePanel(int row, int column)
        {
            Grid main_container = new Grid()
            {
                Margin = new Thickness(60 + 311 * 3, 85, 0, 0)
            };

            CreateButtons(main_container, WarehouseStrings, GetWarehousePanelClickEventHandlers());

            Grid.SetColumn(main_container, column);
            Grid.SetRow(main_container, row);

            return main_container;
        }

        internal static Grid GetEmployeesPanel(Window owner, int row, int column, Database db)
        {
            Grid main_container = new Grid()
            {
                Margin = new Thickness(60 + 311 * 4, 85, 0, 0)
            };

            CreateButtons(main_container, EmployeesStrings, GetEmployeesPanelClickEventHandlers(db, owner));

            Grid.SetColumn(main_container, column);
            Grid.SetRow(main_container, row);

            return main_container;
        }

        internal static Grid GetAccountingPanel(int row, int column)
        {
            Grid main_container = new Grid()
            {
                Margin = new Thickness(61 + 311 * 5, 85, 0, 0)
            };

            CreateButtons(main_container, AccountingStrings, GetAccountingPanelClickEventHandlers());

            Grid.SetColumn(main_container, column);
            Grid.SetRow(main_container, row);

            return main_container;
        }

        private static void CreateButtons(Grid main_container, Tuple<String, String>[] strings, Action<object, RoutedEventArgs>[] actions)
        {
            TicketButton ticket_button;

            if (strings[0].Item1 != "")
            {
                ticket_button = new TicketButton(new Thickness(0, 0, 0, 0), strings[0].Item1, strings[0].Item2, actions[0]);
                Grid.SetColumn(ticket_button.MainContainer, 0);
                Grid.SetRow(ticket_button.MainContainer, 0);

                main_container.Children.Add(ticket_button.MainContainer);
            }

            if (strings[1].Item1 != "")
            {
                ticket_button = new TicketButton(new Thickness(124, 0, 0, 0), strings[1].Item1, strings[1].Item2, actions[1]);
                Grid.SetColumn(ticket_button.MainContainer, 0);
                Grid.SetRow(ticket_button.MainContainer, 0);

                main_container.Children.Add(ticket_button.MainContainer);
            }

            if (strings[2].Item1 != "")
            {
                ticket_button = new TicketButton(new Thickness(0, 110, 0, 0), strings[2].Item1, strings[2].Item2, actions[2]);
                Grid.SetColumn(ticket_button.MainContainer, 0);
                Grid.SetRow(ticket_button.MainContainer, 0);

                main_container.Children.Add(ticket_button.MainContainer);
            }

            if (strings[3].Item1 != "")
            {
                ticket_button = new TicketButton(new Thickness(124, 110, 0, 0), strings[3].Item1, strings[3].Item2, actions[3]);
                Grid.SetColumn(ticket_button.MainContainer, 0);
                Grid.SetRow(ticket_button.MainContainer, 0);

                main_container.Children.Add(ticket_button.MainContainer);
            }
        }

        #endregion

        #region Main Window Button Strings

        private static Tuple<String, String>[] CalendarStrings = new Tuple<string, string>[] { 
            new Tuple<string, string>("Calendario", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/calendario.png"),
            new Tuple<string, string>("Notifiche", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/notifiche.png"),
            new Tuple<string, string>("Sposta", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/postponi.png"),
            new Tuple<string, string>("Nuovo", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/add.png") 
        };

        private static Tuple<String, String>[] CustomersStrings = new Tuple<string, string>[] { 
            new Tuple<string, string>("Clienti", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/clienti.png"),
            new Tuple<string, string>("Compleanni", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/notifiche.png"),
            new Tuple<string, string>("Debitore", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/debitori.png"),
            new Tuple<string, string>("Nuovo", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/add.png")
        };

        private static Tuple<String, String>[] ServicesStrings = new Tuple<string, string>[] { 
            new Tuple<string, string>("Servizi", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/servizi.png"),
            new Tuple<string, string>("", ""),
            new Tuple<string, string>("Invia offerta", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/offerte.png"),
            new Tuple<string, string>("Nuovo", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/add.png")
        };

        private static Tuple<String, String>[] WarehouseStrings = new Tuple<string, string>[] { 
            new Tuple<string, string>("Inventario", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/inventario.png"),
            new Tuple<string, string>("Notifiche", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/notifiche.png"),
            new Tuple<string, string>("Fornitori", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/fornitori.png"),
            new Tuple<string, string>("Nuovo articolo", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/add.png")
        };

        private static Tuple<String, String>[] EmployeesStrings = new Tuple<string, string>[] { 
            new Tuple<string, string>("Personale", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/personale.png"),
            new Tuple<string, string>("Straordinari", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/straordinari.png"),
            new Tuple<string, string>("Statistiche", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/statistiche.png"),
            new Tuple<string, string>("Assenze & Ritardi", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/assenzeritardi.png")
        };

        private static Tuple<String, String>[] AccountingStrings = new Tuple<string, string>[] { 
            new Tuple<string, string>("Lista fatture", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/listafatture.png"),
            new Tuple<string, string>("", ""),
            new Tuple<string, string>("Statistiche", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/statistiche.png"),
            new Tuple<string, string>("Nuova fattura", @"pack://application:,,,/CoiffeurProject;component/Images/Main/Icons/add.png")
        };

        #endregion

    }

    #endregion
}
